﻿#pragma once

#include "Framework/ApplicationSubsystem.h"
#include "Misc/Guid.h"
#include "Shader.h"
#include "Math/Color.h"
#include "MaterialSubsystem.m.h"

class RShader;
class RMaterialShaders;
class RMaterialParameters;
class RMaterial;

//manage  shader file and material
RCLASS()
class WHENGINE_API RMaterialSubsystem: public RApplicationSubsystem
{
    ROBJECT
public:
    virtual void Initialize() override;
    virtual void Deinitialize() override;

    static RMaterialSubsystem* Get();

    RFUNCTION()
    static TSharedObjectPtr<RMaterialSubsystem> GetInstance();

    TSharedObjectPtr<RShader> DefaultVertexShader;
    TSharedObjectPtr<RShader> DefaultFragmentShader;

    //TSharedObjectPtr<RMaterial> DefaultMaterial;

    //创建一个新的材质，这个材质与默认材质一样
    TSharedObjectPtr<RMaterial> CreateDefaultMaterial();

    //创建一个单色不透明材质，这个材质有一个名为“颜色”的参数，可以设置颜色
    TSharedObjectPtr<RMaterial> CreateSingleColorMaterial(const SColor& InOpaqueColor);

    TSharedObjectPtr<RMaterial> CopyMaterial(TSharedObjectPtr<RMaterial> InTemplate);
    
};

